{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from glob import glob\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rm -rf results-1536-v2/checkpoint-97000\n",
      "rm -rf results-1536-v2/checkpoint-97500\n",
      "rm -rf results-1536-v2/checkpoint-98000\n",
      "rm -rf results-1536-v2/checkpoint-98500\n",
      "rm -rf results-1536-v2/checkpoint-99000\n",
      "rm -rf results-1536-v2/checkpoint-99500\n",
      "rm -rf results-1536-v2/checkpoint-100000\n",
      "rm -rf results-1536-v2/checkpoint-100500\n",
      "rm -rf results-1536-v2/checkpoint-101000\n",
      "rm -rf results-1536-v2/checkpoint-101500\n"
     ]
    }
   ],
   "source": [
    "folders = glob('results-1536-v2/checkpoint-*')\n",
    "folders = sorted(folders, key = lambda x: int(x.split('checkpoint-')[1]))\n",
    "for f in folders[:-5]:\n",
    "    command = f'rm -rf {f}'\n",
    "    print(command)\n",
    "    os.system(command)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rm -rf results-1024-packing/checkpoint-15500\n",
      "rm -rf results-1024-packing/checkpoint-16000\n",
      "rm -rf results-1024-packing/checkpoint-16500\n",
      "rm -rf results-1024-packing/checkpoint-17000\n",
      "rm -rf results-1024-packing/checkpoint-17500\n",
      "rm -rf results-1024-packing/checkpoint-18000\n",
      "rm -rf results-1024-packing/checkpoint-18500\n",
      "rm -rf results-1024-packing/checkpoint-19000\n",
      "rm -rf results-1024-packing/checkpoint-19500\n",
      "rm -rf results-1024-packing/checkpoint-20000\n",
      "rm -rf results-1024-packing/checkpoint-20500\n",
      "rm -rf results-1024-packing/checkpoint-21000\n"
     ]
    }
   ],
   "source": [
    "folders = glob('results-1024-packing/checkpoint-*')\n",
    "folders = sorted(folders, key = lambda x: int(x.split('checkpoint-')[1]))\n",
    "for f in folders[:-5]:\n",
    "    command = f'rm -rf {f}'\n",
    "    print(command)\n",
    "    os.system(command)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
